package com.etc.controller;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("log4japi")
public class Log4JController {

	Logger logger1 = Logger.getRootLogger();

	//建议用这种，指定参数为当前类class.
	Logger logger2 = Logger.getLogger(Log4JController.class);

	@RequestMapping("test1")
	public String test1() {
		// System.out.println("test1");
		// 日志记录
		logger1.info("test1 .. log1.info ....");
		logger2.info("test1 .. log2.info ....");
		
		logger1.debug("test1 .. log1.debug ....");
		logger2.debug("test1 .. log2.debug ....");
		
		
		logger1.warn("test1 .. log1.warn ....");
		logger2.warn("test1 .. log2.warn ....");
		
		logger1.error("test1 .. log1.error ....");
		logger2.error("test1 .. log2.error ....");

		return "test1";
	}
}
